{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1c4578e8-c0ec-4581-8733-59641d2c21c3",
   "metadata": {},
   "source": [
    "### Try this notebook in Google Colab, Binder or SageMaker!\n",
    "\n",
    "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/InsightSoftwareConsortium/itkwidgets/blob/main/examples/integrations/PyVista/LiDAR.ipynb)\n",
    "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/InsightSoftwareConsortium/itkwidgets/HEAD?labpath=examples%2Fintegrations%2FPyVista%2FLiDAR.ipynb)\n",
    "[![Open In SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github.com/InsightSoftwareConsortium/itkwidgets/blob/main/examples/integrations/PyVista/LiDAR.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "343e562f-7db1-49f5-87ff-71c2af2b75ba",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Install dependencies for this example\n",
    "import sys\n",
    "\n",
    "!{sys.executable} -m pip install -q pyvista \"itkwidgets[all]>=1.0a23\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "395c7503-042f-470f-8f76-473825a2cd0c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyvista\n",
    "from pyvista import examples\n",
    "\n",
    "from itkwidgets import view"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "47d02562-2919-4b99-b19f-8fe1559e6966",
   "metadata": {},
   "outputs": [],
   "source": [
    "lidar = examples.download_lidar()\n",
    "\n",
    "clipped = lidar.clip(origin=(0, 0, 1.76e3), normal=(0, 0, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "76eba29a-1bf3-4b28-9574-67f71ce350bd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "                <img id=screenshot_imjoy_window_bf63f00c-5690-4270-a8a6-bb6e7a4aa161 src=>\n",
       "                <script id=\"script_imjoy_window_bf63f00c-5690-4270-a8a6-bb6e7a4aa161\" type=\"text/javascript\">\n",
       "                    var container = document.getElementById(\"script_imjoy_window_bf63f00c-5690-4270-a8a6-bb6e7a4aa161\").parentNode;\n",
       "                    var image = document.getElementById(\"screenshot_imjoy_window_bf63f00c-5690-4270-a8a6-bb6e7a4aa161\");\n",
       "                    if (!image) {\n",
       "                        image = document.createElement(\"img\");\n",
       "                        image.id = \"screenshot_imjoy_window_bf63f00c-5690-4270-a8a6-bb6e7a4aa161\";\n",
       "                        container.appendChild(image);\n",
       "                    }\n",
       "                    image.src = \"\";\n",
       "                    var viewer = document.getElementById(\"imjoy_window_bf63f00c-5690-4270-a8a6-bb6e7a4aa161\");\n",
       "                    // Hide the static image if the Viewer is visible\n",
       "                    image.style.display = viewer ? \"none\" : \"block\";\n",
       "                </script>\n",
       "            "
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "window.connectPlugin && window.connectPlugin(\"328c4df8-fcd5-4b11-ac15-bbca57b037ff\")"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div id=\"af183a89-9931-4298-8070-16ca01d7bd51\"></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<itkwidgets.viewer.Viewer at 0x7f4700503e20>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "view(point_set=clipped)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2a674b47-c4fa-47f1-bb15-32043353c20c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
